﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace University_students
{
    class Departments
    {
        public string departmentName;

       public List<Grops> GropeList = new List<Grops>();
        public void AddGropesToDepartments()
        {
            string choice = "";
            do
            {
                Console.WriteLine("Would you like to add new grops? Y/N");
                choice = Console.ReadLine();
                if (choice == "Y")
                {
                    Grops newGrope = new Grops();
                    newGrope.GropeNumberAdding();
                    newGrope.AddStudentsToGrope();
                    GropeList.Add(newGrope);
                }
            } while (choice == "Y");
           
        }


        public void NameOfDepartment()
        {
            Console.WriteLine("Enter the name of department: ");
            departmentName = Console.ReadLine();
        }

        public void DepartmentInfo()
        {
            Console.WriteLine("Department name is - {0}.", departmentName);
        }

        public void PrintGropetDisplay(string choice)
        {
           
            foreach (var singleGrope in GropeList)
            {
                if (choice == "All")
                {
                    singleGrope.GropeInfo();
                    singleGrope.PrintStudentDisplay();
                }
                else if (choice == "S")
                {
                    singleGrope.PrintStudentDisplay();
                }
                else
                {
                    singleGrope.GropeInfo();
                }
            }
        }
        
        public void StraightPrintDeparment()
        {
            foreach (var singleGrope in GropeList)
            {
                singleGrope.GropeInfo();
                singleGrope.PrintStudentDisplay();
            }
        }

        public void PrintStudentsDirectly()
        {
            foreach (var singleGrope in GropeList)
            {
                singleGrope.PrintStudentDisplay();
            }
        }

        public void PrintCertainGrop(double choicePercent, string choiceGropeName)
        {
            
            
            foreach (var singleGrope in GropeList)
            {
                if (choiceGropeName == "All")
                {
                    singleGrope.PrintStudentInfoWithPercentOfAchievementMoreEqual(choicePercent);
                }
                else if (choiceGropeName == singleGrope.gropeNumber)
                {
                    singleGrope.PrintStudentInfoWithPercentOfAchievementMoreEqual(choicePercent);
                }
            }
        }

        public void PrintDirectStidentsForFaculty(double choicePercent)
        {
            
            foreach (var singleGrope in GropeList)
            {
                singleGrope.PrintStudentInfoWithPercentOfAchievementLessEqual(choicePercent);
            }
        }
    }
}
